const { app, BrowserWindow } = require("electron");

const path = require("node:path");

const createWindow = () => {
  const win = new BrowserWindow({
    autoHideMenuBar: true, // 隐藏菜单栏
    width: 1200,
    height: 800,
    webPreferences: {
      nodeIntegration: true,
      preload: path.join(__dirname, 'preload.js')
    },
    icon: path.join(__dirname, "icon.png"),
    title: "Electron Demo",
  });

  win.loadFile("index.html");
  //   开启调试窗口
  win.webContents.openDevTools();
};

app.whenReady().then(() => {
  createWindow();
});

app.on("window-all-closed", () => {
  if (process.platform !== "darwin") app.quit();
});
